import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

// 为路由增加额外配置项
// 1. 定义一个类型 AddRouteRecordRaw 扩展 RouteRecordRaw
export type AddRouteRecordRaw = RouteRecordRaw & {
  hidden?: boolean
}

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      component: () => import('@/views/Home.vue'),
      hidden: false, // 2. 添加对应属性
    }
  ] as AddRouteRecordRaw[] // 3. 使用类型断言为我们自定义的类别
})

export default router